package com.google.gson.internal.bind;

import com.google.gson.b.a;
import com.google.gson.b.c;
import com.google.gson.b.d;
import com.google.gson.internal.ObjectConstructor;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;

final class v extends TypeAdapter {
    final /* synthetic */ u a;
    private final TypeAdapter b;
    private final ObjectConstructor c;

    public v(u uVar, TypeAdapter typeAdapter, ObjectConstructor objectConstructor) {
        this.a = uVar;
        this.b = typeAdapter;
        this.c = objectConstructor;
    }

    public Map a(a aVar) throws IOException {
        if (aVar.f() == c.NULL) {
            aVar.j();
            return null;
        }
        Map map = (Map) this.c.construct();
        aVar.c();
        while (aVar.e()) {
            map.put(aVar.g(), this.b.b(aVar));
        }
        aVar.d();
        return map;
    }

    public void a(d dVar, Map map) throws IOException {
        if (map == null) {
            dVar.f();
            return;
        }
        dVar.d();
        for (Entry entry : map.entrySet()) {
            dVar.a((String) entry.getKey());
            this.b.a(dVar, entry.getValue());
        }
        dVar.e();
    }

    public /* synthetic */ Object b(a aVar) throws IOException {
        return a(aVar);
    }
}
